#include <iostream>
#include <cstring>
using namespace std;
using ull=unsigned long long;
const int N=1e5+10;
const ull base=131;

ull h1[N],h2[N],b[N];

void init(string s)
{
	memset(h1,0,sizeof(h1));
	memset(h2,0,sizeof(h2));
	memset(b,0,sizeof(b));
	int n=s.size()-1;
	b[0]=1;
	for(int i=1;i<=n;i++)
	{
		h1[i]=h1[i-1]*base+s[i]-'a'+1;
		b[i]=b[i-1]*base;
	}
	
	for(int i=n;i>=1;i--)
	{
		h2[i]=h2[i+1]*base+s[i]-'a'+1;
	}
	
}
ull getPre(int l,int r)
{
	return h1[r]-h1[l-1]*b[r-l+1];
}
ull getSub(int l,int r)
{
	return h2[l]-h2[r+1]*b[r-l+1];
}
bool check(ull pre,int pos,int n)
{
	return getSub(pos,n)==pre;
}
int main()
{
	string s;
	int cnt=1;
	while( cnt-- &&cin>>s)
	{
		int ret=0;
		int n=s.size();
		s=' '+s;
		init(s);
		bool flg=false;
		for(int i=n;i>=1 && !flg;i--)
		{
			ull pre=getPre(1,i);
			int left=1,right=n;
			while(left<right)
			{
				int mid=left+right>>1;
				if(check(pre,mid,n))
				{
					right=mid;
				}
				else{
					left=mid+1;
				}
			}
			if(getSub(left,n)==pre)
			{
				ret=n+1;
				flg=true;
			}
		}
		
		cout<<ret<<endl;
	}
	return 0;
}
